<template>
<div>
  <button @click="getStudents">获取学生信息</button><br>
  <button @click="getCars">获取学生信息</button>
</div>
</template>

<script>
import axios from 'axios'
export default {
  name: "AjaxDemo",
  methods: {
    getStudents() {
      axios.get('http://localhost:8080/jojo/studnets').then(
        reponse => {
          console.log('请求成功了', reponse.data)
        },
        error => {
          console.log('请求失败了', error.message)
        }
      )
    },
    getCars() {
      axios.get('http://localhost:8080/atguigu/cars').then(
        response => {
          console.log('请求成功了', response.data)
        },
        error => {
          console.log('请求失败了', error.message)
        }
      )
    }
  }
}
</script>

<style scoped>

</style>
